package task

import event.ReportEvent
import manager.HttpRequestManager
import manager.TaskManager
import org.greenrobot.eventbus.EventBus

/**
 * 通知Server出货成功
 */
class ReportTask(val rowAndCol: String, val order: String) : Runnable {
    override fun run() {
        try {
            exec()
        } catch (e: Exception) {
            e.printStackTrace()
            TaskManager.DelayHandler.postDelayed(this, 2 * 1000)
        }
    }

    private fun exec() {
        HttpRequestManager.reportRepertory(rowAndCol, order)
        EventBus.getDefault().post(ReportEvent())
    }
}